import java.io.*;
import java.awt.Color;
class Bag implements Serializable{
Color color;
String price;
int size;
String type;
public Bag(Color color,String price,int size,String type){
	  this.color = color;
	  this.price = price;
	  this.size = size;
	  this.type = type;
}
}
public class BagSerial{
public static void main(String args[])throws IOException,ClassNotFoundException{
	Color c = Color.red;
	Bag bag = new Bag(c,"57",18,"Student bag");
	FileOutputStream fileO = new FileOutputStream("info.ser");
	ObjectOutputStream OS = new ObjectOutputStream(fileO);
	try{
	     OS.writeObject(bag);
	     OS.close();
	}catch(IOException e){
	     System.out.println(e);
	     }
	bag = null;
	FileInputStream fileI = new FileInputStream("info.ser");
	ObjectInputStream IS =null;
	IS = new ObjectInputStream(fileI);
	try{
	      bag = (Bag)IS.readObject();
	      IS.close();
	}catch(IOException e){
System.out.println(e);
	       }
	System.out.println("*********************************");
	System.out.println("There are information about bag:");
	System.out.println("Color:"+bag.color);
	System.out.println("Price:"+bag.price);
	System.out.println("Size:"+bag.size);
	System.out.println("Type:"+bag.type);
	System.out.println("*********************************");
}
}
